﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EmployeeProject
{
    class HourlyWorker : Employee
    {
        public double Rate{ get; private set; }
        public double Hours{ get; private set; }
        public double Salary{ get; private set; }

        public HourlyWorker(string name, double rate, double hours) :base(name)
        {
            if (rate <= 0)
                throw new ArgumentNullException("Rate cannot be null");
            Rate = rate;
            if (hours <= 0)
                throw new ArgumentNullException("Hours cannot be null or negative");
            Hours = hours;
        }

        public override void CalculateSalary()
        {
            Salary = Rate * Hours;
        }

        public override void PrintToConsole()
        {
            Console.WriteLine("{0}: {1}$",Name, Salary);
        }
    }
}
